package com.mysoft.gfyx.marketdevelop.controller.tag;

import com.mysoft.framework.modeling.OptionDataController;
import com.mysoft.framework.modeling.dto.Filter;
import com.mysoft.framework.modeling.dto.OptionItem;
import com.mysoft.framework.rpc.annotation.PubService;
import com.mysoft.framework.rpc.contants.RequestPrefix;
import com.mysoft.gfyx.marketdevelop.service.LabelService;
import io.swagger.v3.oas.annotations.tags.Tag;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Tag(name = "土地类型第一级-API")
@PubService(value = "/LandTypeSubOptionData", prefix = RequestPrefix.API, method = {})
public class LandTypeSubOptionDataController extends OptionDataController  {
    @Resource
    private LabelService labelService;

    @Override
    protected List<OptionItem> load(List<Filter> filters, Map<String, String> urlParams) {
        String category = "";
        if (filters != null && filters.size() > 0) {
            for (int i = 0; i < filters.size(); i++) {
                if (filters.get(i).getCondition().size() > 0 && filters.get(i).getCondition().get(0).getField().equals("land_usage_category")) {
                    category = filters.get(i).getCondition().get(0).getValue().toString();
                    break;
                }
            }
        }
        return labelService.loadValueTagsLandTypeSub(category);
    }
}
